This article provides an overview and how-to instructions for working with attachments within Ditto. Attachments in Ditto are represented using the ATTACHMENT data type, which you can use to store binary data, such as images, alongside queryable descriptive information, such as file name and description.
For example...
string
values.For example...
Field | Detail | Description |
---|---|---|
id | Attachment ID | A cryptographic hash of the attachment’s binary contents. (See Organizing by ID) |
len | Blob Length | The size of the blob data in terms of length (len) in bytes. (See Blob Store) |
metadata | Metadata | Additional information about the attachment, such as its name, type, and so on. |
Type | Blob Store Location |
---|---|
Small Peer | - If running in the browser or a server-based system, in-memory storage. Specifically, within Random Access Memory (RAM). - If running on a mobile device like an iPhone, filesystem storage. |
Big Peer | Cloud object storage service: Amazon WebServices (AWS) Simple Storage Service (S3). |
newAttachment
method on the store
namespace.
When creating an attachment...
An attachment token is...
Approach | Description |
---|---|
UPDATE | Update the document to remove the associated attachment token. |
EVICT | Delete the entire document, including the associated attachment token, from the Ditto store. |